<?xml version="1.0" encoding="UTF-8"?>
<!--

       Copyright 2006-2016 the original author or authors.

       Licensed under the Apache License, Version 2.0 (the "License");
       you may not use this file except in compliance with the License.
       You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.

-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>MySql Usage Notes</title>
    <link rel="stylesheet" type="text/css" href="../mbgstyle.css"/>
</head>
<body>
<h1>MySql Usage Notes</h1>
<h2>Unsigned Fields</h2>
<p>MySql supports both signed, and unsigned, numeric fields. These are not JDBC types, so MyBatis
    generator cannot automatically account for these types of fields. The Java data types are always signed.
    This can
    lead to a loss of precision when using unsigned fields. The solution is to provide a
    <code>&lt;columnOverride&gt;</code> for any unsigned numeric field in MySql. Here is an example
    of how to deal with an unsigned bigint field in MySql:</p>
<pre>
  &lt;table tableName="ALLTYPES" &gt;
    &lt;columnOverride column="UNSIGNED_BIGINT_FIELD" javaType="java.lang.Object" jdbcType="LONG" /&gt;
  &lt;/table&gt;
</pre>
<p>You will have to cast the returned value to the appropriate type yourself (in this case,
    <code>java.math.BigInteger</code>).</p>
<h2>Catalogs and Schema</h2>
<p>MySql does not properly support SQL catalogs and schema. If you run the <code>create schema</code>
    command in Mysql, it actually creates a database - and the JDBC driver reports it back as a catalog.
    But MySql syntax does not support the standard <code>catalog..table</code> SQL syntax.</p>
<p>For this reason, it is best to not specify either catalog or schema in generator configurations.
    Just specify table names and specify the database in the JDBC URL.</p>
</body>
</html>
